# -*- coding: UTF-8 -*-
# server_assets
# @File : MsgFightResult.py
# @Date : 2023-09-01
# @Author  : wuzhouhai
# @Desc:
import KBEngine
from KBEDebug import *


class StructSkillProficiency:

    def __init__(self):
        self.SkillId = 0
        self.AddProficiency = 0
        self.OldLevel = 0
        self.NewLevel = 0

    def toDict(self):
        dictData = {
            "SkillId": self.SkillId,
            "AddProficiency": self.AddProficiency,
            "OldLevel": self.OldLevel,
            "NewLevel": self.NewLevel,
        }
        return dictData

class StructLootInfo:

    def __init__(self):
        self.ItemId = 0
        self.ItemCount = 0
        self.Coin = 0
        self.ItemQuality = 0
        self.LootType = 0
        self.PetTempletId = 0

    def toDict(self):
        dictData = {
            "ItemId": self.ItemId,
            "ItemCount": self.ItemCount,
            "Coin": self.Coin,
            "ItemQuality": self.ItemQuality,
            "LootType": self.LootType,
            "PetTempletId": self.PetTempletId,
        }
        return dictData

class StructTiggerBuff:

    def __init__(self):
        self.BUFFId = 0
        self.EffectType = 0
        self.EffectSubType = 0
        self.EffectValue = 0

    def toDict(self):
        dictData = {
            "BUFFId": self.BUFFId,
            "EffectType": self.EffectType,
            "EffectSubType": self.EffectSubType,
            "EffectValue": self.EffectValue,
        }
        return dictData

class StructBattlefieldUserInfo:

    def __init__(self):
        self.RoleId = 0
        self.RoleName = u''
        self.Horde = 0
        self.Position = 0
        self.RemainHp = 0
        self.RemainMp = 0
        self.SkillId = 0
        self.Profession = 0
        self.BuffList = list()
        self.HpChange = 0
        self.MpChange = 0
        self.Hit = 0
        self.HpHurt = 0
        self.ImmuneHurt = 0
        self.IsSkipFight = 0
        self.IsBeCri = 0
        self.TiggerBuff = list()
        self.Armor = 0
        self.GodHpChange = 0
        self.SkillGetHpChange = 0

    def toDict(self):
        dictData = {
            "RoleId": self.RoleId,
            "RoleName": self.RoleName,
            "Horde": self.Horde,
            "Position": self.Position,
            "RemainHp": self.RemainHp,
            "RemainMp": self.RemainMp,
            "SkillId": self.SkillId,
            "Profession": self.Profession,
            "BuffList": [],
            "HpChange": self.HpChange,
            "MpChange": self.MpChange,
            "Hit": self.Hit,
            "HpHurt": self.HpHurt,
            "ImmuneHurt": self.ImmuneHurt,
            "IsSkipFight": self.IsSkipFight,
            "IsBeCri": self.IsBeCri,
            "TiggerBuff": [],
            "Armor": self.Armor,
            "GodHpChange": self.GodHpChange,
            "SkillGetHpChange": self.SkillGetHpChange,
        }
        for bf in self.BuffList:
            dictData["BuffList"].append(bf)

        for tg in self.TiggerBuff:
            dictData["TiggerBuff"].append(tg.toDict())
        return dictData


class StructFightInfo:

    def __init__(self):
        self.UserInfo = StructBattlefieldUserInfo()
        self.EffectGroup = list()

    def toDict(self):
        dicData = {
            "UserInfo": self.UserInfo.toDict(),
            "EffectGroup": []
        }
        for ef in self.EffectGroup:
            dicData["EffectGroup"].append(ef.toDict())
        return dicData


class StructRoundInfo:

    def __init__(self):
        self.RoundNumber = 0
        self.FightSetupGroup = list()

    def toDict(self):
        dicData = {
            "RoundNumber": self.RoundNumber,
            "FightSetupGroup": [],
        }
        for sg in self.FightSetupGroup:
            dicData["FightSetupGroup"].append(sg.toDict())
        return dicData


class StructFightRoleInitInfo:

    def __init__(self):
        self.RoleId = 0
        self.RoleName = u''
        self.RoleType = 0
        self.Horde = 0
        self.Position = 0
        self.Hp = 0
        self.Mp = 0
        self.MaxHp = 0
        self.MaxMp = 0
        self.Level = 0

    def toDict(self):
        dictData = {
            "RoleId": self.RoleId,
            "RoleName": self.RoleName,
            "RoleType": self.RoleType,
            "Horde": self.Horde,
            "Position": self.Position,
            "Hp": self.Hp,
            "Mp": self.Mp,
            "MaxHp": self.MaxHp,
            "MaxMp": self.MaxMp,
            "Level": self.Level,
        }
        return dictData


class MsgFightResult:

    def __init__(self):
        self.Result = 0
        self.GuanQia = 0
        self.FightRoleInfo = list()
        self.FightRoundGroup = list()
        self.FResult = 0
        self.Exp = 0
        self.Coin = 0
        self.LootInfo = list()
        self.SkillProficiency = list()
        self.ResultInfo = u''
        self.FightBossTimes = 0
        self.AthleticPoint = 0
        self.AthleticTimes = 0
        self.FightType = 0
        self.SkillPoints = 0
        self.TowerCoin = 0
        self.Gold = 0

    def Reset(self):
        self.Result = 0
        self.FightRoleInfo = list()
        self.FightRoundGroup = list()
        self.FResult = 0
        self.Exp = 0
        self.Coin = 0
        self.LootInfo = list()
        self.SkillProficiency = list()
        self.ResultInfo = u''
        self.FightBossTimes = 0
        self.AthleticPoint = 0
        self.AthleticTimes = 0
        self.FightType = 0
        self.SkillPoints = 0
        self.TowerCoin = 0
        self.Gold = 0

    def toDict(self):
        dictData = {
            "Result": self.Result,
            "GuanQia": self.GuanQia,
            "FightRoleInfo": [],
            "FightRoundGroup": [],
            "FResult": self.FResult,
            "Exp": self.Exp,
            "Coin": self.Coin,
            "LootInfo": [],
            "SkillProficiency": [],
            "ResultInfo": self.ResultInfo,
            "FightBossTimes": self.FightBossTimes,
            "AthleticPoint": self.AthleticPoint,
            "AthleticTimes": self.AthleticPoint,
            "FightType": self.AthleticPoint,
            "SkillPoints": self.AthleticPoint,
            "TowerCoin": self.AthleticPoint,
            "Gold": self.AthleticPoint,
        }

        for fr in self.FightRoleInfo:
            dictData["FightRoleInfo"].append(fr.toDict())

        for frg in self.FightRoundGroup:
            dictData["FightRoundGroup"].append(frg.toDict())
        for lt in self.LootInfo:
            dictData["LootInfo"].append(lt.toDict())
        for sf in self.SkillProficiency:
            dictData["SkillProficiency"].append(sf.toDict())
        return dictData
